<template>
  <div class="app-container">

    <!-- 查询和其他操作 -->
    <div class="filter-container">
      <el-form :inline="true">
        <el-form-item label=" 字典标签">
          <el-input v-model="listQuery.label" clearable class="filter-item" style="max-width: 260px;" placeholder="字典名称"/>
        </el-form-item>
        <el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
				<el-button
					class="filter-item"
				  type="warning"
				  plain
				  icon="el-icon-close"
				  @click="handleClose"
				>关闭</el-button>
      </el-form>
    </div>

    <!-- 查询结果 -->
    <el-table v-loading="listLoading" :data="list" element-loading-text="正在查询中。。。" border fit highlight-current-row >
      <el-table-column align="center" label="字典标签" prop="label"/>
			<el-table-column label="字典键值" align="center" prop="value"></el-table-column>
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.pageSize" @pagination="getList" />
  </div>
</template>

<script>
import { getDataPage, } from '@/api/system/dictionary'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination

export default {
  name: 'Dictionary',
  components: { Pagination },
  data() {
    return {
      list:[],//列表数据
			total:0,//列表条数
			listQuery:{//查询参数
				page: 1,
				pageSize: 10
			},
			listLoading:false,//数据加载
			dictId:'',//
    }
  },
  created() {
		this.dictId = this.$route.params && this.$route.params.dictId;
		this.listQuery.dictType = this.$route.query.dictType
    this.getList()
  },
  methods: {
		handleFilter() {//查询
		  this.listQuery.page = 1
		  this.getList()
		},
    getList() {//获取列表数据
      this.listLoading = true
      getDataPage(this.listQuery).then(response => {
        let data = response.data || {}
        this.list = data.list || []
        this.total = data.total || 0
        this.listLoading = false
      })
    },
		/** 返回按钮操作 */
		handleClose() {
		  const obj = { path: "/system/dictionary" };
			this.$router.push(obj)
		},
  }
}
</script>
<style scoped>

</style>
